package sxe.core;

import snobject.snBoolean;
import snobject.snObject;
import snobject.snObjectArgList;
import step.EvaluationFailure;
import step.FunctionWrapper;

public class or extends FunctionWrapper {

	@Override
	/** implementation of the or construct */
	public snObject Call(snObjectArgList argv) throws EvaluationFailure,
			ClassCastException, ArrayIndexOutOfBoundsException {
		
		if(argv.length()<2)
			throw new EvaluationFailure(super.expnode,
					EvaluationFailureReasons.BAD_PARAMETER_COUNT);
		
		while(argv.hasNext()){
			if(argv.popBoolean().getBoolean()==true)
				return new snBoolean(true);
		}
		
		return new snBoolean(false);
	}
}
